<template>
  <div>
    <ul>
      <li v-for="(item,id) in arr" :key="item">
        <span>{{item}}</span>
        <button @click="del(id)">删除</button>
      </li>
    </ul>
    <button @click="add">生成</button>
  </div>
</template>

<script>
export default {
  data() {
    return {
      arr: [1, 5, 3],
    };
  },
  methods:{
    del(index){
      this.arr.splice(index,1)
    },
    add(){
      this.arr.push(Math.floor(Math.random()*100))
    }
  }
}
</script>

<style>

</style>